package com.itheima.controller;

import com.itheima.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;



@Controller
public class DemoController {

    @RequestMapping("/demo/{id}")
    public String  demo(@PathVariable int id){
        System.out.println(id);
        return "demo.jsp";

    }

    @ResponseBody
    @RequestMapping("/demo1")
    public User demo1(){
        User zhangsan = new User("张三", 18);
        return zhangsan;

    }





}
